package cloudUser.service.impl;

import cloudEntity.dto.user.SmartRoleInsertDTO;
import cloudEntity.dto.user.SmartRoleUpdateDTO;
import cloudEntity.vo.PageBeanVO;
import cloudEntity.vo.user.SmartUserRoleVO;
import cloudUser.mapper.SmartRoleMapper;
import cloudUser.service.SmartUserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @program: Smart School
 * @ClassName SmartUserRoleServiceImpl
 * @description:
 * @author: 陈智博
 * @create: 2025-05-15 20:37
 * @Version 1.0
 **/
@Service
public class SmartUserRoleServiceImpl implements SmartUserRoleService {

    @Autowired
    private SmartRoleMapper smartRoleMapper;

    @Override
    public PageBeanVO<SmartUserRoleVO> GetSmartRoleReturnPage(Integer pageNum, Integer pageSize) {
        Integer pageBean = (pageNum - 1) * pageSize;
        Integer countSize = smartRoleMapper.getUserRoleCount();
        List<SmartUserRoleVO> smartUserByPageInfo = smartRoleMapper.getSmartUserRoleByPageInfo(pageBean, pageSize);
        return new PageBeanVO<>(pageNum,pageSize,countSize,smartUserByPageInfo);
    }

    @Override
    public Integer InsertRoleActor(SmartRoleInsertDTO smartRoleInsertDTO) {
        return smartRoleMapper.InsertRole(smartRoleInsertDTO);
    }

    @Override
    public Integer UpdateRole(SmartRoleUpdateDTO smartRoleUpdateDTO) {
        return smartRoleMapper.UpdateRole(smartRoleUpdateDTO);
    }

    @Override
    public Integer DeleteRole(Integer ids) {
        return smartRoleMapper.DeleteRole(ids);
    }
}
